package com.home.security.core.enums;

/**
 * Description: 客户端枚举
 * Created by 王大宸 on 2020-11-14 2:52
 * Created with IntelliJ IDEA.
 */
public enum AppClientEnum {

    WEB_APP("web_app", "webapp应用"),
    WX_APP("wx_app", "微信小程序"),
    ;

    // 客户端编号
    private final String clientCode;
    // 客户端名称
    private final String clientName;

    public String getClientCode() {
        return clientCode;
    }

    public String getClientName() {
        return clientName;
    }

    AppClientEnum(String clientCode, String clientName) {
        this.clientCode = clientCode;
        this.clientName = clientName;
    }

    /***
     * 功能说明：根据客户端编码获取客户端名称
     *
     * @author 王大宸
     * @date 2020/11/14 2:52
     * @param clientCode 客户端编码
     * @return java.lang.String
     */
    public static String getClientName(String clientCode) {
        AppClientEnum[] enums = AppClientEnum.values();
        for (AppClientEnum clientEnum : enums) {
            if (clientEnum.getClientCode().equals(clientCode)) {
                return clientEnum.getClientName();
            }
        }
        return "未知客户端";
    }

}
